<template>
  <div class="home">
    <HelloWorld msg="你好世界组件"/>
    <van-button type="primary" @click="onPost">登录</van-button>
    <van-button type="default" @click="onGetList">获取预警列表</van-button>
    <router-view/>
  </div>
</template>

<script>
import HelloWorld from '@/components/HelloWorld.vue';
export default {
  name: 'HomeView',
  components: {
    HelloWorld
  },
  data() {
    return {
      token: ''
    }
  },
  methods: {
    async onPost() {
      const res = await this.$apiFuns.login.login({ account: '103918' });
      this.token = res.data.userinfo.token;
      console.log('this.token', this.token)
    },
    async onGetList() {
      const res = await this.$apiFuns.login.warn.list({ 
        token: this.token,
        offset: 10,
        limit: 1
      });
      console.log('onGetList', res);
    }
  }
}
</script>
